package cn.iocoder.yudao.module.crm.dal.mysql.label;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.crm.dal.dataobject.label.CrmLabelDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.crm.controller.admin.label.vo.*;

/**
 * 客户标签 Mapper
 *
 * @author 数创万维
 */
@Mapper
public interface CrmLabelMapper extends BaseMapperX<CrmLabelDO> {

    default PageResult<CrmLabelDO> selectPage(CrmLabelPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CrmLabelDO>()
                .likeIfPresent(CrmLabelDO::getName, reqVO.getName())
                .eqIfPresent(CrmLabelDO::getBgColor, reqVO.getBgColor())
                .eqIfPresent(CrmLabelDO::getTextColor, reqVO.getTextColor())
                .eqIfPresent(CrmLabelDO::getSetId, reqVO.getSetId())
                .eqIfPresent(CrmLabelDO::getSort, reqVO.getSort())
                .betweenIfPresent(CrmLabelDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CrmLabelDO::getSort));
    }

}